<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="t" tagdir="/WEB-INF/tags"%>
<t:link />
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="utf-8">
</head>
<title>修改模块详情信息</title>

<body>
	<div class="row">
		<div class="col-lg-12 col-sm-12 col-xs-12">
			<div class="widget  dev">
				<div class="widget-body">
					<div id="horizontal-form">
						<form class="form-horizontal" role="form" action="" method="post">
							<input type="hidden" id="id" name="id" value="${cateData.cateId}">
							<input type="hidden" id="cateId" name="cateId" value="${cateData.cateId}">
							<input type="hidden" id="userId" name="userId" value="${cateData.userId}">
							<input type="hidden" id="isopen" name="isopen" value="${cateData.isopen}">
							<div class="form-group">
								<label for="content"
									class="col-sm-2 control-label no-padding-right">信息描述</label>
								<div class="col-sm-6">
								<textarea class="form-control" id="content" name="content" >${cateData.content}
                                </textarea> 
									<%-- <input class="form-control" id="content" name="content"
										type="text" value="${cateData.content}"> --%>
								</div>
							</div>
							<div class="form-group">
								<label for="weight"
									class="col-sm-2 control-label no-padding-right">权重</label>
								<div class="col-sm-6">
									<input class="form-control" id="weight" placeholder=""
										name="weight" type="text" value="${cateData.weight}">
								</div>
								<p class="help-block col-sm-4 red">影响显示顺序(整数从小到大)</p>
							</div>
							<div class="form-group">
								<label for="isopen"
									class="col-sm-2 control-label no-padding-right">是否公开</label>
								<div class="col-sm-6">
									公开:<input id="open1" name="isopen" type="radio" value="0"> 不公开:<input
										id="open2" name="isopen" type="radio" value="1">
								</div>
								<p class="help-block col-sm-4 red"></p>
							</div>
							<div class="form-group">
								<div class="col-sm-offset-2 col-sm-10">
									<button id="button" type="button" class="btn btn-default">保存信息</button>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>


</body>


<script>

	$().ready(function(){
		
		//初始化是否公开数据
		initIsOpen()
	})
	
	function initIsOpen(){
		var tt =$("#isopen").val();
		if(0==tt){
			$("#open1").attr("checked","checked");
		}else{
			$("#open2").attr("checked","checked");
		}
	}

	$("#button").click(
			function() {
				var cate = new Object();
				cate.id=$("#id").val();
				cate.cateId=$("#cateId").val(),
				cate.userId=$("#userId").val(),
				cate.content=$("#content").val(),
				cate.weight=$("#weight").val(),
				cate.isopen=$('input:radio[name="isopen"]:checked').val()
				$.ajax({
					url : "${pageContext.request.contextPath}/resume/catedata/updatecatedata",
					type : "POST",
					data : {
						catejson : JSON.stringify(cate)
					},
					success : function(data) {
						alert("保存成功!");
						/* window.open(
								"${pageContext.request.contextPath}/resume/catedata",
								"_self"); */
					},
					error : function(data) {
						alert("保存失败!");
					}
				})

			})
</script>

</html>